package cn.cjp.day01;

public class Array {
    public static void main(String[] args) {
        //动态初始化
        int[] a = new int[5];
        String[] b = new String[2];

        //静态初始化
        int[] arrayA = new int[]{2, 3, 4};

        //省略
        String[] arrayB = {"fh", "dhf"};

        //拆开
        int[] arrayC;
        arrayC = new int[]{22, 33};

        //数组赋值
        int[] arrayD = arrayC;

        //长度
        int len = arrayA.length;
        System.out.println(len);
        System.out.println("========================================");

        //作为参数
        printlnArray(arrayA);
        System.out.println("========================================");

        //作为返回值
        int[] arrayE = calulate(1,2,3,4);
        printlnArray(arrayE);
        System.out.println("========================================");
    }

        public static void printlnArray(int[] array) {
            for (int i = 0; i < array.length; i++) {
                System.out.println(array[i]);
            }
        }

        public static int[] calulate(int a,int b,int c,int d){
          int sum =a+b+c+d;
          int agv = sum/4;
          int[] array = {sum ,agv};
          return array;
        }

}
